#pragma once

#include "type.h"
#include "assertable.h"
#include "writer.h"
#include "testable.h"

using namespace AllTing;

namespace AllTing
{

namespace Test
{

static const UInt32 DEBUG_MAX_LOG_BUFFER = 8192 * sizeof(Char);
    
class Debug : public IAssertable
{
public:
	Debug(IWritable* pWritable):pWritable_(pWritable), pActiveTest_(Null), nAssert_(0)
	{
	}
	virtual ~Debug();

	void Writer(IWritable* pWriter);
	void ActiveTest(Test::Testable* pActiveTest);
	const Testable* ActiveTest();

	virtual void Assert(Bool bCondition, const Char* pszFile, UInt32 nLine) const;
    
	UInt32 Log(const Char* /*pszFormat*/, ...) const;
    Bool Report();
protected:
	IWritable*	pWritable_;
	Testable*	pActiveTest_;
	mutable UInt32	nAssert_;

	mutable Char	szBuffer_[DEBUG_MAX_LOG_BUFFER];
};

}	//namespace Test

}	//namespace AllTing